package com.GatherFour;

import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ScoreBoard extends Activity {

	private TextView[] playerPos = new TextView[4];
	private Player[] playerList = new Player[4];
	private int playerNum = 2;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.score_board);
        playerPos[0] = (TextView)findViewById(R.id.player_sc1);
        playerPos[1] = (TextView)findViewById(R.id.player_sc2);
        playerPos[2] = (TextView)findViewById(R.id.player_sc3);
        playerPos[3] = (TextView)findViewById(R.id.player_sc4);
        
        for(int i = 0; i< 4; i++){
        	playerPos[i].setText("None");
        }
        
        Bundle bundle = this.getIntent().getExtras();
       
        for(int j = 0; j< playerNum; j++)
        	playerList[j] = (Player)bundle.getSerializable("player"+j);
        
        
        for(int i = playerList.length, j = 0; i> 0 && j < playerList.length; i--, j++){
        	playerPos[j].setText((j+1)+". "+playerList[i-1].name+":"+playerList[i-1].score);
        }
    }
}
